import org.jnativehook.GlobalScreen;
import org.jnativehook.NativeHookException;
import org.jnativehook.keyboard.NativeKeyEvent;
import org.jnativehook.keyboard.NativeKeyListener;

import java.util.logging.Level;
import java.util.logging.Logger;

public class Hotkey {
    private static final Logger logger = Logger.getLogger(GlobalScreen.class.getPackage().getName());

    public static void main(String[] args) {
        try {
            logger.setLevel(Level.OFF);
            GlobalScreen.registerNativeHook();
        } catch (NativeHookException ex) {
            ex.printStackTrace();
        }
        GlobalScreen.addNativeKeyListener(new NativeKeyListener() {
            @Override
            public void nativeKeyTyped(NativeKeyEvent nativeKeyEvent) {

            }

            @Override
            public void nativeKeyPressed(NativeKeyEvent nativeKeyEvent) {
//                System.out.println(NativeInputEvent.getModifiersText(nativeKeyEvent.getModifiers()));
                System.out.println(nativeKeyEvent.getModifiers());
                System.out.println(nativeKeyEvent.paramString());
//                System.out.println(NativeInputEvent.getModifiersText(NativeInputEvent.SHIFT_MASK));
//                System.out.println(NativeInputEvent.getModifiersText(NativeInputEvent.SHIFT_L_MASK));
//                System.out.println(NativeInputEvent.getModifiersText(NativeInputEvent.SHIFT_R_MASK));
            }

            @Override
            public void nativeKeyReleased(NativeKeyEvent nativeKeyEvent) {
//                pressedKey.remove((Object) nativeKeyEvent.getKeyCode());
            }
        });
    }
}
